import { datashopAxios, dataQueryAxios } from '@/utils/request'

// 获取用户列表
export const getAllUserList = (params: any = {}): Promise<any> => {
  return datashopAxios({
    url: '/api/datashop/v3/users',
    method: 'get',
    params: {
      page: 1,
      page_size: 10,
      ...params
    }
  }).then((res: any) =>
    res.items.map((item: any) => ({
      label: item.name,
      value: item.id
    }))
  )
}

// 已发布数据项
export const getAllPublishDataItem = (params: any = {}): Promise<any> => {
  return dataQueryAxios({
    url: `/api/data-query/v1/release-items`,
    method: 'get',
    params: {
      page: 1,
      page_size: 10,
      release_status: 'published',
      ...params
    }
  }).then((res: any) =>
    res.items.map((item: any) => ({
      label: item.name,
      value: item.id
    }))
  )
}
